<template>
    <div class="screen_page">
        <div class="page_header">
            <div class="menu" style="opacity: 0">占位box</div>
            <div class="title">桂中大数据驾驶舱</div>
            <div class="menu">
                <span @click.stop="goMainPage">管理模式</span>
                <span @click="loginOut()"><icon-poweroff /></span>
            </div>
        </div>
        <div class="page_content">
            <div class="content_box" style="flex: 1">
                <div class="slide">
                    <angleBox>
                        <StoreOverview name="门店概况" style="height: 1.4rem"/>
                        <StoreDistribution name="门店分布" style="flex:1"/>
                        <StoreRanking name="门店排名" style="flex:1"/>
                    </angleBox>
                </div>
                <div class="content">
                    <angleBox>
                        <div class="video_total">
                            <div class="total_box">
                                <div class="total">
                                    <NumItem title="摄像头总数" :num="totalData.AcceptMonitorCount|| '-'" color="#0783FF"/>
                                    <NumItem title="新增" :num="totalData.AddMonitorCount|| '-'" type="small"
                                             color="#33DCF6"/>
                                    <NumItem title="在线" :num="totalData.OnlineMonitorCount|| '-'" type="small"
                                             color="#05E842"/>
                                    <NumItem title="在线率" :num="(totalData.OnlineMonitorPercent || '-')+'%'" type="small"
                                             color="#05E842"/>
                                    <NumItem title="离线" :num="totalData.OfflineMonitorCount|| '-'" type="small"
                                             color="#E02020"/>
                                </div>
                                <div class="search">

                                </div>
                            </div>
                            <div class="player_box">
<!--                                <videoPlayer :options="options"/>-->
                            </div>
                        </div>
                    </angleBox>
                </div>
                <div class="slide">
                    <angleBox>

                    </angleBox>
                </div>
            </div>
            <div class="content_box" style="height:2.3rem; margin-top: .2rem ">
                <angleBox></angleBox>
            </div>
        </div>
    </div>
</template>

<script setup>
    import StoreOverview from './components/storeOverview'
    import StoreDistribution from './components/storeDistribution'
    import StoreRanking from './components/storeRanking'
    import videoPlayer from '@components/local/videoPlayer'

    import './screen.less'


    // 视频组件配置
    const options = {

        // 当前视频请求地址,必填
        url: $Server.video.GetCac_FirmMonitorByAreaIdName,

        // 播放个数
        size:4,

        // 是否在底部显示视频名称
        showTitle:true,

        // 水印展示 ， 如果设置为空或不设置，则不展示水印
        watermark:'黑晶科技',

        // 工具栏配置
        controller:[
            'recorder',  // 视频录制
            'screenshot',  // 视频截图
            //'call',  // 语音对讲
            //'playback',  // 视频回放
            'refresh',  // 刷新
            'volume',  // 静音
            'fullScreen',  // 全屏
        ]

    }

    const totalData = ref({})

    onMounted(()=>{
        getTotal()
    })

    //请求统计数据
    const getTotal=()=>{
        $HTTP.post($Server.screen.GetFirmStatistic , {}).then(res=>{
            let data = {}
            for (let key in res.Data) {
                data[key] = parseInt(res.Data[key]) + ''
            }
            totalData.value = data
        })
    }

    const goMainPage=()=>{
        $router.push('/')
    }

    const loginOut = ()=>{
        $router.push('/login')
    }

</script>

<style scoped lang="less">

    .video_total{
        height: 100%;
        width: 100%;
        display: flex;
        flex-direction: column;

        .total_box {
            display: flex;
            justify-content: space-between;
            margin-bottom: .1rem;
            padding: 0 .2rem;
            .button {
                outline: none;
                cursor: pointer;
                display: block;
                padding: 0 .2rem;
                height: 0.25rem;
                margin-left: 0.2rem;
                border: 1px solid #01B4FF;
                background-color: #060E3A;
                color: #01B4FF;
            }
            .total {
                flex: 1;
                display: flex;

                .total_item:not(:first-child) {
                    margin-left: .4rem;
                }
            }
            .search {
                display: flex;
                align-items: flex-end;
            }
        }

        .player_box{
            flex: 1;
            border: .02rem solid #000;
            overflow: hidden;
            display: flex;
            flex-wrap: wrap;
            .flex_player{
                border: .01rem solid #000;
            }
        }

    }

</style>